package casino;

import java.net.InetAddress;

public class LanScanThread extends Thread {
	private String subnet;
	private MessageFrame frame;
	
	public LanScanThread(String s, MessageFrame f){
		super();
		subnet = s;
		frame = f;
	}
	
	public void run(){
		while(!frame.connected){
			for (int i=1;i<254;i++){
				String host=subnet + "." + i;
				try{
					if (InetAddress.getByName(host).isReachable(25) && !InetAddress.getByName(host).equals(InetAddress.getLocalHost())){
						if(frame.testClient(InetAddress.getByName(host))){
							return;
						}
					}
				}catch(Exception e){}
			}
		}
	}
}
